<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<link href="<c:url value='/css/draw.css'/>" rel="stylesheet">
<link href="<c:url value='/css/easyui.css'/>" rel="stylesheet">
<link href="<c:url value='/css/icon.css'/>" rel="stylesheet">
<script src="<c:url value='/js/jquery.min.js'/>"></script>
<script type="text/javascript"
	src="<c:url value='/js/jquery.easyui.min.js'/>"></script>
<div class="page-header">
	<h3 style="margin-top: auto">数据实体组件详细信息</h3>
</div>
<div class="row-fluid">
	<div>
		<table class="table table-hover" style="width: 95%">
			<thead>
				<tr>
					<th style="width: 15%">属性</th>
					<th style="width: 85%">详细信息</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>名称</td>
					<td><c:out value="${item.name}" /></td>
				</tr>
				<tr>
					<td>数据实体</td>
					<td><c:choose>
							<c:when test="${!empty item.entity}">
								<c:out value="${item.entity.name}" />
							</c:when>
						</c:choose></td>
				</tr>
				<tr>
					<td>创建时间</td>
					<td><c:out value="${item.createTime.getYear()+1900}" />-<c:out
							value="${item.createTime.getMonth()+1}" />-<c:out
							value="${item.createTime.getDate()}" /></td>
				</tr>
				<tr>
					<td>最近修改时间</td>
					<td><c:out value="${item.lastModified.getYear()+1900}" />-<c:out
							value="${item.lastModified.getMonth()+1}" />-<c:out
							value="${item.lastModified.getDate()}" /></td>
				</tr>
				<tr>
					<td>版本</td>
					<td><c:out value="${item.version}" /></td>
				</tr>
				<tr>
					<td>创建者</td>
					<td><c:out value="${item.owner.username}" /></td>
				</tr>
				<tr>
					<td>描述信息</td>
					<td><c:out value="${item.description}" /></td>
				</tr>
				<tr>
					<td>依赖项</td>
					<td><c:choose>
							<c:when test="${!empty item.depends}">
								<c:forEach items="${item.depends}" var="list" varStatus="s">
									<c:choose>
										<c:when test="${!empty list.entity}">
											<c:out value="${list.entity.name}" />
											<br />
										</c:when>
									</c:choose>
								</c:forEach>
							</c:when>
						</c:choose></td>
				</tr>
				<tr>
					<td>操作</td>
					<td><div class="btn-group">
							<button class="btn" onclick="javascript:$('#myModal').dialog('open')"><i class="icon-trash"></i>&nbsp;删除</button>
							<button class="btn"
								onclick="window.location.href='<%=request.getContextPath()%>/${item.uri.replace(':','/')}/download';"><i class="icon-download"></i>&nbsp;下载</button>
						</div></td>
				</tr>
				<c:choose>
					<c:when test="${!empty item.entity}">

						<tr class="info">
							<td colspan="2" align="center"><center>
									<strong>数据实体详细信息</strong>
								</center></td>
						</tr>
						<tr>
							<td>名称</td>
							<td><c:out value="${item.entity.name}" /></td>
						</tr>
						<tr>
							<td>属性</td>
							<td><c:choose>
									<c:when test="${!empty item.entity.attributes}">
										<c:forEach items="${item.entity.attributes}" var="attribute"
											varStatus="s">
											<c:out value="${attribute.name}" />
											<br />
										</c:forEach>
									</c:when>
								</c:choose></td>
						</tr>
						<tr>
							<td>函数</td>
							<td><c:choose>
									<c:when test="${!empty item.entity.opertions}">
										<c:forEach items="${item.entity.opertions}" var="opertion"
											varStatus="s">
											<c:out value="${opertion.interfaceMethod.methodSigniture}" />
											<br />
										</c:forEach>
									</c:when>
								</c:choose></td>
						</tr>
						<tr>
							<td>类型</td>
							<td><c:out value="${item.entity.type}" /></td>
						</tr>
						<tr>
							<td>聚合项</td>
							<td><c:choose>
									<c:when test="${!empty item.entity.aggregations}">
										<c:forEach items="${item.entity.aggregations}" var="list"
											varStatus="s">
											<c:out value="${list.name}" />
											<br />
										</c:forEach>
									</c:when>
								</c:choose></td>
						</tr>
						<tr>
							<td>继承项</td>
							<td><c:choose>
									<c:when test="${!empty item.entity.extendsSet}">
										<c:forEach items="${item.entity.extendsSet}" var="list"
											varStatus="s">
											<c:out value="${list.name}" />
											<br />
										</c:forEach>
									</c:when>
								</c:choose></td>
						</tr>
						<tr>
							<td>依赖项</td>
							<td><c:choose>
									<c:when test="${!empty item.entity.depends}">
										<c:forEach items="${item.entity.depends}" var="list"
											varStatus="s">
											<c:out value="${list.name}" />
											<br />
										</c:forEach>
									</c:when>
								</c:choose></td>
						</tr>
						<c:choose>
							<c:when test="${!empty item.entity.diagram}">
								<tr>
									<td colspan="2">
										<p>类图</p> <iframe class="mainIframe" frameborder="0"
											scrolling="auto"
											src="<%=request.getContextPath()%>/${item.entity.diagram.uri.replace(':','/')}?entityName=${item.entity.name}"></iframe>
									</td>
								</tr>
							</c:when>
						</c:choose>
					</c:when>
				</c:choose>
			</tbody>
			<tfoot>
			</tfoot>
		</table>

	</div>
</div>
<!--/row-->
<div id="myModal" class="easyui-dialog" title="删除数据实体"
							style="width: 400px; height: auto; padding: 10px" closed="true"
							data-options="iconCls: 'icon-remove-dialog'" buttons="#dlg-buttons">
							<div>
								<p>确定删除该数据实体吗？</p>
							</div>
						</div>
						<div id="dlg-buttons" style="float: right;">
							<a href="<%=request.getContextPath()%>/${item.uri.replace(':','/')}/delete" class="easyui-linkbutton"
								iconCls="icon-ok-dialog" onclick="dlgOK()">确定</a> <a
								href="javascript:void(0)"
								class="easyui-linkbutton" iconCls="icon-cancel-dialog"
								onclick="dlgCancel()">取消</a>
						</div> <script type="text/javascript">
			$(function() {
				$('#myModal').dialog('close');
			});
			function dlgOK(){
				$('#myModal').dialog('close');
			}
			function dlgCancel(){
				$('#myModal').dialog('close');
			}
	</script>